UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h48M/qTeubgGS5x2heQbNVUQjTuSjrVIbSpBztDM180=' 
WHERE 
  key_id = 'ae3bf504e4e108b20be35aa34e925fe5f42531384025de6fedae9648fbb88104' 
  AND (
    token = 'h48M/qTeubgGS5x2heQbNVUQjTuSjrVIbSpBztDM180=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038