UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZZKgWAnPGfsejwTU/SCAfRgR5eeBtJce1SNMvlv1qPY=' 
WHERE 
  key_id = 'e1f478908c307791183d362090c6b49bcb7529d8aa09c8d6ae227f28b947f401' 
  AND (
    token = 'ZZKgWAnPGfsejwTU/SCAfRgR5eeBtJce1SNMvlv1qPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037