UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wOgbrSL7U7YUqfdy9RIF2lNSs/FuqjejjGenyB0RD/0=' 
WHERE 
  key_id = 'b0d8c76a35cd7febc5f93098f239e827d4ab46183217c8d7c49a74216d361276' 
  AND (
    token = 'wOgbrSL7U7YUqfdy9RIF2lNSs/FuqjejjGenyB0RD/0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023