UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'btfMVz3tAqG4aVOyDLDqP5D3Zfns0fn+2oRT5JFVjb4=' 
WHERE 
  key_id = '074942104b0b75393f998d88394c8f74164b5c55387fc2cb3889068d010690f2' 
  AND (
    token = 'btfMVz3tAqG4aVOyDLDqP5D3Zfns0fn+2oRT5JFVjb4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032