UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cJPAhH574eQTlFEnRRZ9VLsQl4PYkCd14CiEtFJ4ppA=' 
WHERE 
  key_id = '3a9263a320c0f9028bcc5dbe1784626a7fd413d8d5dd056950f0b48c06e32fe6' 
  AND (
    token = 'cJPAhH574eQTlFEnRRZ9VLsQl4PYkCd14CiEtFJ4ppA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029