UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ha2UG3vq1oOx3u9kHXKfQKRN0Pfm60d+2SWTx/mNhW4=' 
WHERE 
  key_id = 'f06930956c18994badbca4a3e86c58d7ec258400b06fb162b95995d91f82a405' 
  AND (
    token = 'Ha2UG3vq1oOx3u9kHXKfQKRN0Pfm60d+2SWTx/mNhW4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041