UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JHD2XF6p4hH7MHjnVHqlwzSeZfEtBJIl4fk1N/ZOXVc=' 
WHERE 
  key_id = 'a0fb5d179c5c2e3e7ea5502f570aeb451612d1b24b5782e9032343384eee255a' 
  AND (
    token = 'JHD2XF6p4hH7MHjnVHqlwzSeZfEtBJIl4fk1N/ZOXVc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021