UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TIIec3qRmkEDKmr+thTbFPL/oE3ce31PZVI1DGkjjzo=' 
WHERE 
  key_id = '5f7a98884a891680e5bde4ec1448423678071c476bc19f9da086451aa1be8469' 
  AND (
    token = 'TIIec3qRmkEDKmr+thTbFPL/oE3ce31PZVI1DGkjjzo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031