UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9x1ZScC1NtJBXjWQcmSHXXe24LewSduczZW5ihbcDE4=' 
WHERE 
  key_id = 'ab9f5ba49dd2294e937a993f5d087c26eb2159be2a2a74d18de80919ec6ecbd7' 
  AND (
    token = '9x1ZScC1NtJBXjWQcmSHXXe24LewSduczZW5ihbcDE4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030