UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eM/bJf+iunYUE+DynS16Pp0sEaLg84JDMFUqu7snPl8=' 
WHERE 
  key_id = '65c43a4362f412522453548c29c0e232e97484d4e1d8c20f6d4fd2c3d7605b12' 
  AND (
    token = 'eM/bJf+iunYUE+DynS16Pp0sEaLg84JDMFUqu7snPl8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037