UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZpmlEruGGFstiSODx0C0uGy/HmshHDxGNU+BhnzQORk=' 
WHERE 
  key_id = '21d78a736c8606977ebe78a1a06c3f524de612e24b769e779c788917dfc30a5b' 
  AND (
    token = 'ZpmlEruGGFstiSODx0C0uGy/HmshHDxGNU+BhnzQORk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022