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

Query time 0.00021