UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0MBmvCd7ruj3vxSkbawcWWGnJFCEFkjRY1u54l2XtBk=' 
WHERE 
  key_id = '1a35f61c41a36be8813a27d97ea02e9e7450e95415b97c5ad086e86154b9344a' 
  AND (
    token = '0MBmvCd7ruj3vxSkbawcWWGnJFCEFkjRY1u54l2XtBk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046