UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gt+6hvo9uV5pXRIUs6R7GZ+vHhQ9pnjVvBGicgDEY0A=' 
WHERE 
  key_id = 'dc30d3f96dadc5e0c2171a0455b2b87bdf87a3c86158733368f3699e74d63fcd' 
  AND (
    token = 'gt+6hvo9uV5pXRIUs6R7GZ+vHhQ9pnjVvBGicgDEY0A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024