UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y+4yOvC2id7jdlLf76XGrSAeKdjp4eVKwANTII6M/KU=' 
WHERE 
  key_id = '21cc054ba1cba65e828a11a2121bbbd6f8266472eb986493c3d5b31244b31258' 
  AND (
    token = 'Y+4yOvC2id7jdlLf76XGrSAeKdjp4eVKwANTII6M/KU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027