UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '02hJyHDv3kwYC8VnBgnkxmTrVsXwhtaZXbFy+Xj6hnM=' 
WHERE 
  key_id = '57933d2c3fb82c0d9cc180476a8b11f07806133452c6adee4894cf98cdb0f07d' 
  AND (
    token = '02hJyHDv3kwYC8VnBgnkxmTrVsXwhtaZXbFy+Xj6hnM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039