UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JI9OPcktHK212i5rr8MnZy0tyaVJUwEVCBqcwAzy700=' 
WHERE 
  key_id = '39b6392cd7214d29c8e8d8123ee59d9e46742db55c8b479d59a15a3c778ea650' 
  AND (
    token = 'JI9OPcktHK212i5rr8MnZy0tyaVJUwEVCBqcwAzy700=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035