UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T9VWWtonp0C4AYkAxzgU4BC9pLgr+8QlDADBsNJr81s=' 
WHERE 
  key_id = '6fe03579f99b21da302ce786160df056145774357ac5f47e89079aaeed1aad0c' 
  AND (
    token = 'T9VWWtonp0C4AYkAxzgU4BC9pLgr+8QlDADBsNJr81s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017