UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vR4rOOvywic8Z+cz7YUFgmS/BJ3lvrXN2YkxEy9TtI8=' 
WHERE 
  key_id = '0acddb3554960be2db671d4b45c8795e14195fc0388550ac8fb01fb919596635' 
  AND (
    token = 'vR4rOOvywic8Z+cz7YUFgmS/BJ3lvrXN2YkxEy9TtI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036