UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R4uLu8oNLuzRcCM5O6wxPosIwKnk3x+3ktYALlTINS8=' 
WHERE 
  key_id = 'af0e6e3c7542ef4a2ce9a43936b60f5e21c10126ada00d002eab7e280d291583' 
  AND (
    token = 'R4uLu8oNLuzRcCM5O6wxPosIwKnk3x+3ktYALlTINS8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032