UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TTdCL5i+j2aWqWuEp99Il6GRuezE3Ty2QTXLOmesD7s=' 
WHERE 
  key_id = '2d40b7c65b06b001c6865bb7d9ea51b21c8b8fd4f3c632dce7d0cac9276f6fbd' 
  AND (
    token = 'TTdCL5i+j2aWqWuEp99Il6GRuezE3Ty2QTXLOmesD7s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014