UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1GrE2WMr/kZbnBNvvaazCubWQPNUuALhTvvC5PG+8LY=' 
WHERE 
  key_id = 'b702162c833c9eec9ca5869f1bff6627e985235243aae299bd10e1239e3b4113' 
  AND (
    token = '1GrE2WMr/kZbnBNvvaazCubWQPNUuALhTvvC5PG+8LY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052