UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LHtatzKnv7IOkgO2fUQQ5DUAlxIQnKLLrD4c4H5av+4=' 
WHERE 
  key_id = 'e97c07f29a0f74abbb93e71da61c16c6bda035a00402c84f58d106e8743d61ea' 
  AND (
    token = 'LHtatzKnv7IOkgO2fUQQ5DUAlxIQnKLLrD4c4H5av+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038