UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0TScXagWPmjIPVLj0UMqKtWAuQvvQUCai/dM5LV0i3M=' 
WHERE 
  key_id = '696408766dc8cab80f1960981ff131ee4439282a0bf81b4c09d541743a5f6fef' 
  AND (
    token = '0TScXagWPmjIPVLj0UMqKtWAuQvvQUCai/dM5LV0i3M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037