UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ItgJP4CV2TzUB5Ri5HsGLo895xfA4NzSl/hKXkUUrC8=' 
WHERE 
  key_id = 'abafd2e45edff0e72f40db5562e7fce16a254d0ea24e1e23b028f2544235b738' 
  AND (
    token = 'ItgJP4CV2TzUB5Ri5HsGLo895xfA4NzSl/hKXkUUrC8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024