UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RsdmMZkirgp6PO/gn09f3MAIsAUQr+HSFj3cBX7UjMA=' 
WHERE 
  key_id = '7384b403a83b3040e27a503fad52ec77402d369d9154c34945c1c131c64bcccf' 
  AND (
    token = 'RsdmMZkirgp6PO/gn09f3MAIsAUQr+HSFj3cBX7UjMA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031