UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sIZNnT7kEFiOv/qsOakLUBu7ASV0Cbef/gpvs3t8YvY=' 
WHERE 
  key_id = '7751ef09816f598b33503f69a421f265f9eedaf607c2fb92709221721d11ed36' 
  AND (
    token = 'sIZNnT7kEFiOv/qsOakLUBu7ASV0Cbef/gpvs3t8YvY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024