UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bX3G5Vx2I3R+m9CJSJwt/AVAo408bLSShxaN1Li3FLA=' 
WHERE 
  key_id = '24b95fa432cf639fde021e67cfa537664b9f4cdd9f069a98860369c4581a8952' 
  AND (
    token = 'bX3G5Vx2I3R+m9CJSJwt/AVAo408bLSShxaN1Li3FLA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032