UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g4ZPHx5E1GlBTxYI2QQBJvQgoZLNY6aY7xSgdWxBjfk=' 
WHERE 
  key_id = '13c0deaa1aafaf15a8a37b9897c70a82dd4e98152195c98732ec556d397e7f35' 
  AND (
    token = 'g4ZPHx5E1GlBTxYI2QQBJvQgoZLNY6aY7xSgdWxBjfk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057