UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tZto2zxb8MFJ/tVTvYCB0XlYf91GvZL24aXfT1MMfJ4=' 
WHERE 
  key_id = '1713cbac047903451565b42650cf786f857fd0f31480bd9eae7be51645f2f4c0' 
  AND (
    token = 'tZto2zxb8MFJ/tVTvYCB0XlYf91GvZL24aXfT1MMfJ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035