UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'syx7YK44tjpUVLvd33Lo7VQbaIeU2nvYhf3PKNHz0Xk=' 
WHERE 
  key_id = '7477aa7d377f7ef9e20e986617542ba87f0022685ab11099bbb5dd03597bf921' 
  AND (
    token = 'syx7YK44tjpUVLvd33Lo7VQbaIeU2nvYhf3PKNHz0Xk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023