UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AoH0f7Ahgu5FS9cI2JJMp5vuwsTXj+C8HstEcgiBv1c=' 
WHERE 
  key_id = 'f38d40cb1b8570bda20b6a8a3e2a737f36deffc0664cfcbbb3f498ffc1212c30' 
  AND (
    token = 'AoH0f7Ahgu5FS9cI2JJMp5vuwsTXj+C8HstEcgiBv1c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030