UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nef+8A8xXCgetSis2DGVXqqlI8iIAEc/gEjiSGA00BQ=' 
WHERE 
  key_id = '5744d378255bc6955f2f109f51adb5c24afaa29ac0d7fd192289ed68ac02e8f9' 
  AND (
    token = 'nef+8A8xXCgetSis2DGVXqqlI8iIAEc/gEjiSGA00BQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039