UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Suc+JA8qSmDBtvt4FBJcQC/NEvMugbUWZ8hDBiZCdR8=' 
WHERE 
  key_id = '8f5baf83f04a2a456166fa0a86ef6171e3820766eca4972fc9ea61215303d824' 
  AND (
    token = 'Suc+JA8qSmDBtvt4FBJcQC/NEvMugbUWZ8hDBiZCdR8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031