UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2SA68jUhN5O2vTIJPwz6v0NcI3Zo5aMNVizGr+8Ws4o=' 
WHERE 
  key_id = '140948286bebdef354d12f2e66ce3ab1152eff2973ff4c323c9922a92d7bd203' 
  AND (
    token = '2SA68jUhN5O2vTIJPwz6v0NcI3Zo5aMNVizGr+8Ws4o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034