UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RZ0eXNF8SrgffD5oIIvyb7mQq9HaZJbqk189G+Lkp5g=' 
WHERE 
  key_id = '822824822f639594466e7634369768de02876fdb80f7f96f5a2477b56d734dc5' 
  AND (
    token = 'RZ0eXNF8SrgffD5oIIvyb7mQq9HaZJbqk189G+Lkp5g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042