UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CNSxSrx5iHyPtAGbii6u/QwPk/tNdA1ph/2Ip/fYBRw=' 
WHERE 
  key_id = '8012397bb4bb7a0d207b9a5343977c58be62cef1a038ad4f699035f9bb9815eb' 
  AND (
    token = 'CNSxSrx5iHyPtAGbii6u/QwPk/tNdA1ph/2Ip/fYBRw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037