UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WA+lGVK1+fL5jv1hnb/XpHndGPdImA8SetxGPagjaIk=' 
WHERE 
  key_id = '0d986089f85d682e9538e6df22c6f05204bc590235e6a4b0cc42d4f29c11921a' 
  AND (
    token = 'WA+lGVK1+fL5jv1hnb/XpHndGPdImA8SetxGPagjaIk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037