UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Aws/6tZpAeYxjYT1AYw1PX85ebFsl8GHYqNfZ0F+tFg=' 
WHERE 
  key_id = '783cf81431cd501fccca485e3cb0b98149123c01d09c93845d00d25bf8beaf51' 
  AND (
    token = 'Aws/6tZpAeYxjYT1AYw1PX85ebFsl8GHYqNfZ0F+tFg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042