UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KwrR29uj+zpN49oTbgiXR9x7B3dPmWqPFo0R+HNyPhI=' 
WHERE 
  key_id = 'b217118c021e5965c28513dc4a984f1a23be797dd43b32c3bfeed1cd7113802f' 
  AND (
    token = 'KwrR29uj+zpN49oTbgiXR9x7B3dPmWqPFo0R+HNyPhI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031