UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2KE76N5iaTzb1WsjZtbOsFPRp8d/KMoTIyhrUV799WU=' 
WHERE 
  key_id = 'fec7e971c466de2fd6a69e851fe6d36af4f617abf4265fcf7b35a9649408dfee' 
  AND (
    token = '2KE76N5iaTzb1WsjZtbOsFPRp8d/KMoTIyhrUV799WU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018