UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uzci2SFtBYRYlgH5O12s/e+FiRz4C0Gsbd7symaCs5s=' 
WHERE 
  key_id = '7a7c7a9bef34eaa706aae42820fa08e4a026a65cd2def6742ab1bc68b2b59744' 
  AND (
    token = 'uzci2SFtBYRYlgH5O12s/e+FiRz4C0Gsbd7symaCs5s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031